package com.naiterui.ehp.bs.patient.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.naiterui.common.repository.core.BaseJpaRepository;
import com.naiterui.ehp.bp.domain.ConsultBill;

/**
 * <pre>
 * 问诊账单持久化接口实现
 * </pre>
 *
 * @author fangguanhong
 * @date 2020/4/9 下午4:05
 * @since 1.0.0
 */
@Repository
public interface IApConsultBillRepository extends BaseJpaRepository<ConsultBill, Long> {

    List<ConsultBill> findByIdIn(List<Long> ids);

    @Query(value = "select c from ConsultBill c where c.patientId = ?1 and (c.resourceType = 0 or resourceType = 1) and payStatus = 0 order by " +
            "c.createdAt asc")
    List<ConsultBill> getUnPayBills(Long patientId);

}
